<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>Registration</title>
	<style>
.panel {
	width: 600px;
}
</style>
</h:head>
<h:body>
	<h:form>
		<p:growl id="msgs" showDetail="true" />
		<p:panel class="panel" header="Registration Form">
			<h:panelGrid columns="3" id="regGrid">
				<h:outputLabel for="firstname">firstname:</h:outputLabel>
				<p:inputText id="firstname"
					value="#{registrationBean.user.firstname}">
					<p:ajax update="firstnamemsg" />
				</p:inputText>
				<p:message id="firstnamemsg" for="firstname" />

				<h:outputLabel for="lastname">lastname:</h:outputLabel>
				<p:inputText id="lastname" value="#{registrationBean.user.lastname}">
					<p:ajax update="lastnamemsg" />
				</p:inputText>
				<p:message id="lastnamemsg" for="lastname" />

				<h:outputLabel for="email">Email:</h:outputLabel>
				<p:inputText id="email" value="#{registrationBean.user.email}">
					<p:ajax update="emailmsg" />
				</p:inputText>
				<p:message id="emailmsg" for="email" />

				<h:outputLabel for="username">username:</h:outputLabel>
				<p:inputText id="username" value="#{registrationBean.user.username}">
					<p:ajax update="usernamemsg" />
				</p:inputText>
				<p:message id="usernamemsg" for="username" />

				<h:outputLabel for="password">Password:</h:outputLabel>
				<p:password id="password" value="#{registrationBean.user.password}"
					feedback="true" match="pwd2" label="Password" />
				<p:message for="password" />

				<h:outputLabel for="pwd2">Confirm Password:</h:outputLabel>
				<p:password id="pwd2" label="Confirm Password" />
			</h:panelGrid>
			<p:commandButton value="Register"
				action="#{registrationBean.register()}" update="msgs" />
			<p:commandButton value="Login Page" action="loginPage"
				immediate="true" />

		</p:panel>
	</h:form>
</h:body>
</html>